home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT8 / PG0807.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-05-10  |  5.8 KB  |  120 lines

  1. ;***********************************************************************
  2. ;
  3. ;  Program PG0807 ( Chapter 8 )
  4. ;
  5. ;  Demo program for working with video pages
  6. ;
  7. ;  Author: A.I.Sopin,  VSU,  Voronezh,  1992
  8. ;
  9. ;  The BIOS video service is used (function 0Eh of interrupt 10h)
  10. ;
  11. ;***********************************************************************
  12. .model  small
  13.  
  14. EXTRN   VIDTYP : FAR, PUTSTR : FAR, WRCHAR : FAR
  15.  
  16. LF      EQU     10      ;  Line Feed
  17. CR      EQU     13      ;  Carriage Return
  18.  
  19. ;----------------------------------------------------------
  20. .stack
  21. .data
  22. STRING  DB      80 dup ('E'), 0
  23. TEXT0   DB      ' Video Page Demonstrion (BIOS  INT  10h).  Press any key...'
  24.     DB      CR, LF, '$'
  25. TEXT1   DB      ' Video Type = '
  26. VTypeS  DB      'X'
  27.     DB      '   MODE = '
  28. VModeS  DB      'X'
  29.     DB      '    Press any key...$'
  30. VT      DB      0
  31. VMODE   DB      0               ; original video mode saved
  32. PAGEN   DB      ' Video Page Number is = '
  33. PagenS  DB      'X'
  34.     DB      '                 ', 0
  35. ;----------------------------------------------------------
  36. .CODE
  37. .startup
  38.     mov     ah,0Fh                  ;  function 0Fh - get video mode
  39.     int     10h                     ;  BIOS video service call
  40.     mov     VMODE,al                ;  save original video mode
  41.     mov     ah,0                    ;  function 00h - set video mode
  42.     mov     al,2                    ;  video mode 2 - 80x25  B & W
  43.     int     10h                     ;  BIOS video service call
  44.     mov     ah,2                    ;  function 02h - set cursor
  45.     xor     dx,dx                   ;  cursor position 0, 0
  46.     xor     bh,bh                   ;  video page 0 is used
  47.     int     10h                     ;  BIOS video service call
  48.     lea     dx,TEXT0                ;  address of text to be output
  49.     mov     ah,9                    ;  function 09h - output text string
  50.     int     21h                     ;  DOS service call
  51.     xor     ah,ah                   ;  function 00h - get key
  52.     int     16h                     ;  BIOS keyboard service call
  53. ;  determine and report the video adapter type and video mode
  54.     Call    VIDTYP                  ;
  55.     mov     VT,al                   ;  save video type
  56.     mov     es,dx                   ;  ES points to video buffer
  57.     mov     VTypeS,al               ;  Video Adapter Type
  58.     or      VTypeS,30h              ;  Bin ---> ASCII
  59.     mov     ah,0Fh                  ;  function 0Fh - get video mode
  60.     int     10h                     ;  BIOS video service call
  61.     mov     VModeS,al               ;  Video Mode
  62.     or      VModeS,30h              ;  Bin ---> ASCII
  63.     lea     dx,TEXT1                ;  address of text to be output
  64.     mov     ah,9                    ;  function 09h - output text string
  65.     int     21h                     ;  DOS service call
  66.     xor     ah,ah                   ;  function 00h - get key
  67.     int     16h                     ;  BIOS keyboard service call
  68.     mov     ah,2                    ;  function 02h - set cursor
  69.     xor     dx,dx                   ;  cursor position 0, 0
  70.     xor     bh,bh                   ;  video page 0 is used
  71.     int     10h                     ;  BIOS video service call
  72.     mov     ah,2                    ;  function 02h - Set Cursor
  73.     mov     dx,1950h                ;  cursor location ot of screen
  74.     xor     bh,bh                   ;  video page 0 is used
  75.     int     10h                     ;  BIOS video service call
  76. ;-------------------------------------------------------------------
  77. ;  Create four video pages
  78.     mov     bx,0                    ; initial video pge number
  79.     mov     cx,4                    ; number of video pages
  80. M0:     push    cx                      ; save cycle counter
  81.     mov     PagenS,bh               ; current video page number
  82.     or      PagenS,30h              ; convert to character
  83.     lea     si,PAGEN                ; addres of string to be output
  84.     mov     ah,07h                  ; attribute for output
  85.     mov     cx,80                   ; max length of string
  86.     xor     dx,dx                   ; output from beginning of string
  87.     mov     bl,VT                   ; video card type
  88.     Call    PUTSTR                  ; call output subroutine
  89.     mov     dx,0100h                ; row 2 column 1
  90.     mov     cx,1920                 ; output 24 lines
  91.     mov     ah,07h                  ; attribute
  92.     mov     al,bh                   ; AL - current video page number
  93.     or      al,30h                  ; convert to character
  94.     Call    WRCHAR                  ; output 1920 characters
  95.     pop     cx                      ; restore cycle counter
  96.     inc     bh                      ; modify video page number
  97.     loop    M0                      ; next performance of cycle
  98. ;-------------------------------------------------------------------
  99. ;  Switching video pages
  100.     mov     cx,4                    ;  number of video pages
  101.     xor     bh,bh                   ;  initial video page = 0
  102. M1:     xor     ah,ah                   ;  function 0 - read key
  103.     int     16h                     ;  BIOS video service call
  104.     mov     ah,5                    ;  Function - Set Display Page
  105.     mov     al,bh                   ;  Display Page
  106.     int     10h                     ;  Set Display Page
  107.     inc     bh                      ;  Next Display Page
  108.     loop    M1                      ;
  109.     xor     ah,ah                   ;  function 00h - get key
  110.     int     16h                     ;  BIOS keyboard service call
  111. ;-------------------------------------------------------------------
  112. ;  Finish the program and return to MS-DOS
  113. Exit:   mov     al,VMODE                ;  AL - original video mode
  114.     xor     ah,ah                   ;  function 00h - set video mode
  115.     int     10h                     ;  BIOS video service call
  116.     mov     ax,4C00h                ;  Return Code =0
  117.     int     21h                     ;  DOS service call
  118. ;-------------------------------------------------------------------
  119.     END
  120.